﻿using System;

namespace ThirdDigitSeven
{
    class ThirdDigitSeven
    {
        static void Main()
        {
            while (true)
            {
                Console.Write("Eneter Numebr: ");
                string textEntered = Console.ReadLine(); //read the number

                if (textEntered != "exit") //check if it is an exit string
                {
                    int number;
                    bool parse = int.TryParse(textEntered, out number); //try parse the string to uint

                    if (!parse) //if not parsed print message and wait for number or "exit"
                    {
                        Console.WriteLine("Please enter number or type \"exit\"");
                        continue;
                    }

                    if (number <= int.MaxValue) //check if uint.MaxValue is reached
                    {
                        Console.WriteLine("Third digit is seven: {0}", (number / 100) % 10 == 7 ? "TRUE" : "FALSE"); //print the result
                    }
                }

                break;

            }
        }
    }
}
